The technical field of the present invention relates generally to image processing and more particularly to error clipping for vector error diffusion.
Color digital printing devices typically employ only a small set of colorants. For example, many digital color-printing devices employ only black, yellow, magenta and cyan colorants. These colorants are placed on a printing substrate to optically blend together to create a large range of colors. Yellow, magenta and cyan are subtractive colorants that filter out colors in order to produce a desired color. Other digital color devices employ additive colors, such as red, green and blue, that additively combine to produce a desired color. The range of colors that may be produced from a set of colorants forms a xe2x80x9ccolor gamut.xe2x80x9d
Digital color printing devices often employ xe2x80x9cdigital halftoningxe2x80x9d techniques. These techniques attempt to approximate a continuous tone image using a limited subset of colorants that are displayed for pixels of the image. For each pixel in the image, the halftone representation may not match the original tone for the image. As a result, the halftone image has an element of error at the pixel. Hence, a number of different techniques have been introduced to seek to reduce the amount of error and reduce the amount of noise that is visible in an image.
Error diffusion is one of the techniques that has been employed to attempt to reduce the amount of error or noise in an image where digital halftoning is employed. Error diffusion seeks to diffuse an error for a given pixel among neighboring pixels so as to compensate for the error. An example is helpful to illustrate the operation of error diffusion. FIG. 1 depicts a portion of an image containing two rows of pixels: row 1 and row 2. The pixels are ordered from left to right on a row by row basis. Row 1 contains pixels P1, P2, P3 and P4, and row 2 contains pixels P5, P6, P7 and P8. Suppose that pixel P1 is represented by an output color that differs from the source color (i.e. the desired color from the image). The error representing the difference between the output color and the source color is diffused to neighboring pixels P2, P5 and P6 (as indicated by the arrows in FIG. 1). In particular, the error vector for pixel P1 may be multiplied by respective weights and then added to source colors for the pixels P2, P5 and P6. In an ideal case, the weights sum to a value of 1.
Unfortunately, certain artifacts and problems can arise when error diffusion is applied. These problems and artifacts may result in noise in the resulting image.
The present invention provides an innovative approach to error diffusion that eliminates some of the problems that may occur with conventional error diffusion techniques. In one embodiment of the present invention, error vectors are diffused to neighboring pixels as part of an error diffusion technique. The combination of the error vector with the source color is clipped so that the combination does not significantly extend beyond a color gamut boundary. The combination may be clipped so that it does not extend any greater than 25% of the width of the color gamut beyond the boundary of the color gamut.
In accordance with a further aspect of the present invention, a method for processing an image is practiced in an electronic device. In accordance with this method, an error vector is provided that represents a portion of an error between a desired color for a first pixel and a first output color for the first pixel that is output on an output device. The error vector is added to a source color for a second pixel to produce a resulting vector that extends beyond a color space by a given length to a terminating point. The resulting vector is clipped so that the resulting vector is shortened to less than the given length. The terminating point at the resulting vector, still, however, lies outside the color space. A second output color is determined for the second pixel. The second output color is a selected one of the output colors that is a shortest distance in the color space from the terminating point of resulting vector.
In accordance with another aspect of the present invention, an electronic device includes a storage that holds image data for pixels in an image. The electronic device may be a computer system, a printer or other type of output device. The electronic device includes a processor for processing an error vector. The error vector represents at least a portion of the error between a source color for a first of the pixels and an output color for the first of the pixels. The processor processes the error vector to add the error vector to a source color for a second of the pixels to produce a resulting vector that extends outside the color space. The processor clips the resulting vector so that the resulting vector is shortened but still lies outside the color space.
In accordance with an additional aspect of the present invention, a method of processing image data for an image that is to be output on an output device is practiced in an electronic apparatus. Per this method, a color cube is provided that represents possible colors for pixels in the image. The color cube includes colorants constituting colors that can be output by the output device. The location of a source color for a first pixel of the image in the color cube is identified. The source color represents a desired color to be output for the first pixel. A determination is made to determine a selected one of the colorants in the color cube that is closest in distance and location on the source color for the first pixel in the color cube. It is determined that the selected colorant is to be output for the first pixel. An error vector is calculated to represent error between the location of the source color for the first pixel in the color cube and the location of the selected colorant in the color cube. The error vector begins at the location of the source color for the first pixel and the color cube and has a length equal to a magnitude of the error and a direction opposite to a vector that extends from the location of the source color for the first pixel towards the location of the selected color in the color cube. Where a sum of a source color for a second pixel in the image and the error vector extends outside the color cube, the sum is clipped to produce a sum clipped source vector that extends outside the color cube. The clipped source vector still extends more than negligibly beyond the color cube. The clipped source vector is employed in deciding which of the colorants to output for the second pixel.